package cn.sfrog.project.biz.web.controller;

import cn.sfrog.common.core.controller.BaseController;
import cn.sfrog.common.core.domain.ApiAjaxResult;
import cn.sfrog.project.biz.admin.domain.BizAgency;
import cn.sfrog.project.biz.admin.service.IBizAgencyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/api/agency")
@Api(value = "/api/agency", tags = "APP代理服务相关")
public class AppAgencyController extends BaseController {
    @Autowired
    private IBizAgencyService bizAgencyService;

    @ApiOperation(value = "接收代理申请表")
    @PostMapping("/receiveAgency")
    public ApiAjaxResult receiveAgency(@RequestBody @Validated BizAgency vo) {
        System.out.println("代理申请信息=======>" + vo);
        Long aLong = bizAgencyService.selectSysUserByPhone(vo.getAgencyPhone());
        vo.setUserId(aLong);
        vo.setAgencyStatus("0");
        int i = bizAgencyService.insertBizAgency(vo);
        System.out.println(vo);
        return ApiAjaxResult.success(i);

    }

}
